package cloud.maque.auth.fegin;

import cloud.maque.auth.model.BaseUserModel;
import cloud.maque.auth.model.LoginRequest;
import cloud.maque.auth.model.LoginResponse;
import cloud.maque.common.core.response.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "maque-auth")
public interface AuthUserFeginClient {

    @GetMapping("/get-user-by-openid/{openid}")
    R<String> GetUserByOpenId(@PathVariable("openid") String openid);


    @PostMapping("/auth/login")
    R<LoginResponse> Login(@RequestBody LoginRequest request);


    @PostMapping("/auth/user/get-user-by-thrid/{thirdType}/{thridUserId}")
    R<BaseUserModel> GetUserByThrid(@PathVariable("thirdType") String thirdType, @PathVariable("thridUserId") String thridUserId);


    @PostMapping("/auth/user/get-userinfo/{userId}")
    R<BaseUserModel> GetUserInfo(@PathVariable("userId") String userId);


    @PostMapping("/auth/user/get-by-phone/{phone}")
    R<BaseUserModel> GetUserInfoByPhone(@PathVariable("phone") String phone);

    @PostMapping("/auth/user/get-user-totp-secret/{userId}")
    R<String> getUserTotpSecret(@PathVariable("userId") String userId);

    @PostMapping("/auth/user/update-user-totp-secret")
    R<Boolean> updateUserTotpSecret(@RequestParam("userId") String userId, @RequestParam("totpSecret") String totpSecret);
}
